<?php

$path = 'D:/www/smit/';

$excluded = array();
$i = 0;
$files = array();

function detect($dir = '')
{
	global $excluded, $i, $files;

	$iterator = new DirectoryIterator($dir);
	foreach ($iterator as $fileinfo) {
		if (!$fileinfo->isDot() && !in_array(strtolower($fileinfo->getFilename()), $excluded)) {
			//echo $iterator->getPath() . '/' . $fileinfo->getFilename() . chr(10);
			if(in_array(strtolower($fileinfo->getFilename()), array('.svn', 'thumbs.db', 'desktop.ini')))
			{
				$i++;
				$files[] = $iterator->getPath() . '/' . $fileinfo->getFilename();
			}
			if($iterator->getType() == 'dir')
			{
				detect($iterator->getPath() . '/' . $fileinfo->getFilename() . '/');
			}
		}
	}
}

detect($path);

echo
'
-------------------------------------------------------
	Detected '.$i.' Leftover Files
	
	The Files are listed for review
	'.implode("\n\t", $files).'
-------------------------------------------------------
';
?>